Skip to content

[SYCL] Throw kernel_not_supported for copies to/from unused device_image_scope device_global - #23709

Open
dyniols wants to merge 3 commits into
intel:syclfrom
dyniols:runtime_error_missing_device_extension
Open

dyniols wants to merge 3 commits into
intel:syclfrom
dyniols:runtime_error_missing_device_extension

Conversation

@dyniols

@dyniols dyniols commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

The SYCL device_global spec says that if a device_global has the device_image_scope property, at least one kernel in its device image must access it. Otherwise copy/memcpy to or from it must throw an exception with errc::kernel_not_supported.

Based on spec https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/experimental/sycl_ext_oneapi_device_global.asciidoc

Globals without device_image_scope, and globals that a kernel does use, are unchanged.

Related to: CMPLRLLVM-52861

@dyniols
dyniols requested a balanced review from Copilot November 3, 2026 14:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

4 open issues
What changed in this PR

Updates SYCL device_global copy/memcpy behavior to comply with the device_image_scope requirement: copying to/from a device_global that is not referenced by any kernel in its device image now throws errc::kernel_not_supported.

Changes:

  • Add unit and e2e coverage for kernel_not_supported when copying/memcpy’ing an unused device_image_scope device_global
  • Change runtime behavior in handler to throw (instead of host-only fallback) for unused device_image_scope device_global
  • Align a related runtime error code in memory_manager to errc::kernel_not_supported
File Description
sycl/​unittests/​Extensions/​DeviceGlobal.cpp Adds unit tests for throwing behavior with unused device_image_scope, and validates host-only behavior for non-scoped globals
sycl/​test-e2e/​DeviceGlobal/​device_global_unused_dis.cpp Updates e2e test to expect kernel_not_supported for unused device_image_scope globals
sycl/​source/​detail/​memory_manager.cpp Changes error code to kernel_not_supported when no device image contains the device_global
sycl/​include/​sycl/​handler.hpp Throws kernel_not_supported for unused device_image_scope globals; keeps host-only fallback for non-scoped globals

Review effort: Lite

Comment thread sycl/source/detail/memory_manager.cpp Resolved
Comment thread sycl/include/sycl/handler.hpp Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dyniols
dyniols marked this pull request as ready for review November 3, 2026 18:56
@dyniols
dyniols requested a review from a team as a code owner November 3, 2026 18:56
@dyniols
dyniols requested a review from uditagarwal97 November 3, 2026 18:56

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants